package com.haven123.cloudapp.common.data;

public class QueueX {
    private int maxSize;
    private long[] queArray;
    private int font;
    private int rear;
    private int nItems;

    public QueueX(int size){
        maxSize=size;
        queArray=new long[size];
        font=0;
        rear=-1;
        nItems=0;
    }
    public void insert(long j){
        if(rear==maxSize-1){
            rear=-1;
        }
        queArray[++rear]=j;
        nItems++;
    }
    public long remove(){
        long temp=queArray[font++];
        if(font==maxSize){
            font=0;
        }
        nItems--;
        return temp;
    }
}
